package oa.hleast.xswl.common.config;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;

@Slf4j
@Configuration
@EnableAsync
@AllArgsConstructor
public class AppConfig {

    public static final String ALIYUN_REGION_ID = "cn-hangzhou";

    private final AppProps appProps;


    @Bean
    public IAcsClient iAcsClient() {
        log.info("appProps = {}", appProps);
//        LTAI5tKxnp8TpDPHKiRDkKMs
//                VzE5cLWqpOk38nkWL0VbzbEyIDb97y
//        DefaultProfile profile = DefaultProfile.getProfile(ALIYUN_REGION_ID, appProps.getAliyunSmsAccessKey(), appProps.getAliyunSmsAccessSecret());
        DefaultProfile profile = DefaultProfile.getProfile(ALIYUN_REGION_ID, "LTAI5tKxnp8TpDPHKiRDkKMs", "VzE5cLWqpOk38nkWL0VbzbEyIDb97y");
        return new DefaultAcsClient(profile);
    }
}
